using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._AnalysisTools._Overlay
{
    /// <summary>
    /// <para>Apportion Polygon</para>
    /// <para>Summarizes the attributes of an input polygon layer based on the
    /// spatial overlay of a target polygon layer and assigns the summarized attributes to the target polygons. The target polygons have summed numeric attributes derived from the input polygons that each target overlaps. This process is
    /// typically known as apportioning or apportionment.</para>
    /// <para>根据
    /// 目标面图层的空间叠加，并将汇总属性分配给目标面。目标面已将从每个目标重叠的输入面派生的数值属性相加。这个过程是
    /// 通常称为分摊或分摊。</para>
    /// </summary>    
    [DisplayName("Apportion Polygon")]
    public class ApportionPolygon : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ApportionPolygon()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_features">
        /// <para>Input Polygons</para>
        /// <para>The polygon features with numeric attributes that will be summarized into the target polygon geometries.</para>
        /// <para>具有数值属性的面要素，这些属性将汇总到目标面几何中。</para>
        /// </param>
        /// <param name="_apportion_fields">
        /// <para>Fields to Apportion</para>
        /// <para>The numeric fields from the input polygons that will be summarized by each target polygon and recorded in the output feature class.</para>
        /// <para>输入面中的数值字段，这些字段将由每个目标面汇总并记录在输出要素类中。</para>
        /// </param>
        /// <param name="_target_features">
        /// <para>Target Polygons</para>
        /// <para>The polygon features and their apportioned fields that will be copied to the output feature class.</para>
        /// <para>将复制到输出要素类的面要素及其分摊字段。</para>
        /// </param>
        /// <param name="_out_features">
        /// <para>Output Feature Class</para>
        /// <para>The output feature class containing the attribute and geometries of the target polygons as well as the specified apportion fields from the input polygons.</para>
        /// <para>输出要素类，包含目标面的属性和几何，以及输入面的指定分摊字段。</para>
        /// </param>
        /// <param name="_method">
        /// <para>Apportion Method</para>
        /// <para><xdoc>
        ///   <para>Specifies the method that will be used to apportion the fields from the input polygons to the target polygons.</para>
        ///   <bulletList>
        ///     <bullet_item>Area—The amount that each input polygon contributes to the summarized values for each target feature will be determined by the area of overlap between the two features. If an input feature overlaps two target features by the same amount, the apportioned fields will be divided in two and contribute to both target features by half of the total value. This is the default.</bullet_item><para/>
        ///     <bullet_item>Length—The attributes from the input features will be divided based on the percentage of how much of a line is within each target feature. Only the line intersecting the input feature is included in the calculation. The line outside the input feature is excluded. For example, if one target feature covers 750 meters of a line, and another target feature covers 250 meters of a line, 75% (750 / 1000) of the input feature's attribute values will be aggregated to the first target feature, and 25% (250 / 1000) of the input feature's attribute values will be aggregated to the second target feature.</bullet_item><para/>
        ///     <bullet_item>Points—The attributes from the input features will be divided based on the number of points inside each target feature overlapping an input feature. Points outside of the input feature are excluded. Optionally, a weight field can be specified so that the total weight of all points within each target feature will be used to determine how the input features' attribute values are divided. For example, if two target features overlap one input feature, and there are two points inside the first target feature and eight points inside the second target feature, 20% (2 / 10) of the input feature's attribute values will be aggregated to the first target feature, and 80% (8 / 10) of the input feature's attribute values will be aggregated to the second target feature.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将用于将字段从输入多边形分摊到目标多边形的方法。</para>
        ///   <bulletList>
        ///     <bullet_item>面积—每个输入面对每个目标要素的汇总值的贡献量将由两个要素之间的重叠面积确定。如果输入要素与两个目标要素重叠的量相同，则分配的字段将一分为二，并按总值的一半对两个目标要素的贡献。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>长度 - 输入要素中的属性将根据每个目标要素中线的百分比进行划分。计算中仅包括与输入要素相交的线。输入要素外部的线被排除在外。例如，如果一个目标要素覆盖一条线的 750 米，而另一个目标要素覆盖一条线的 250 米，则输入要素的 75% （750 / 1000） 属性值将聚合到第一个目标要素，25% （250 / 1000） 的输入要素属性值将聚合到第二个目标要素。</bullet_item><para/>
        ///     <bullet_item>点—输入要素中的属性将根据与输入要素重叠的每个目标要素内的点数进行划分。输入要素之外的点被排除在外。或者，可以指定权重字段，以便使用每个目标要素中所有点的总权重来确定如何划分输入要素的属性值。例如，如果两个目标要素与一个输入要素重叠，并且第一个目标要素内有 2 个点，第二个目标要素内有 8 个点，则输入要素的 20% （2 / 10） 属性值将聚合到第一个目标要素中，80% （8 / 10） 的输入要素属性值将聚合到第二个目标要素中。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public ApportionPolygon(object _in_features, List<object> _apportion_fields, object _target_features, object _out_features, _method_value _method)
        {
            this._in_features = _in_features;
            this._apportion_fields = _apportion_fields;
            this._target_features = _target_features;
            this._out_features = _out_features;
            this._method = _method;
        }
        public override string ToolboxName => "Analysis Tools";

        public override string ToolName => "Apportion Polygon";

        public override string CallName => "analysis.ApportionPolygon";

        public override List<string> AcceptEnvironments => ["extent", "outputCoordinateSystem", "parallelProcessingFactor", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_features, _apportion_fields, _target_features, _out_features, _method.GetGPValue(), _estimation_features, _weight_field, _maintain_geometries.GetGPValue()];

        /// <summary>
        /// <para>Input Polygons</para>
        /// <para>The polygon features with numeric attributes that will be summarized into the target polygon geometries.</para>
        /// <para>具有数值属性的面要素，这些属性将汇总到目标面几何中。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Polygons")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_features { get; set; }


        /// <summary>
        /// <para>Fields to Apportion</para>
        /// <para>The numeric fields from the input polygons that will be summarized by each target polygon and recorded in the output feature class.</para>
        /// <para>输入面中的数值字段，这些字段将由每个目标面汇总并记录在输出要素类中。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Fields to Apportion")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _apportion_fields { get; set; }


        /// <summary>
        /// <para>Target Polygons</para>
        /// <para>The polygon features and their apportioned fields that will be copied to the output feature class.</para>
        /// <para>将复制到输出要素类的面要素及其分摊字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Target Polygons")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _target_features { get; set; }


        /// <summary>
        /// <para>Output Feature Class</para>
        /// <para>The output feature class containing the attribute and geometries of the target polygons as well as the specified apportion fields from the input polygons.</para>
        /// <para>输出要素类，包含目标面的属性和几何，以及输入面的指定分摊字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Feature Class")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_features { get; set; }


        /// <summary>
        /// <para>Apportion Method</para>
        /// <para><xdoc>
        ///   <para>Specifies the method that will be used to apportion the fields from the input polygons to the target polygons.</para>
        ///   <bulletList>
        ///     <bullet_item>Area—The amount that each input polygon contributes to the summarized values for each target feature will be determined by the area of overlap between the two features. If an input feature overlaps two target features by the same amount, the apportioned fields will be divided in two and contribute to both target features by half of the total value. This is the default.</bullet_item><para/>
        ///     <bullet_item>Length—The attributes from the input features will be divided based on the percentage of how much of a line is within each target feature. Only the line intersecting the input feature is included in the calculation. The line outside the input feature is excluded. For example, if one target feature covers 750 meters of a line, and another target feature covers 250 meters of a line, 75% (750 / 1000) of the input feature's attribute values will be aggregated to the first target feature, and 25% (250 / 1000) of the input feature's attribute values will be aggregated to the second target feature.</bullet_item><para/>
        ///     <bullet_item>Points—The attributes from the input features will be divided based on the number of points inside each target feature overlapping an input feature. Points outside of the input feature are excluded. Optionally, a weight field can be specified so that the total weight of all points within each target feature will be used to determine how the input features' attribute values are divided. For example, if two target features overlap one input feature, and there are two points inside the first target feature and eight points inside the second target feature, 20% (2 / 10) of the input feature's attribute values will be aggregated to the first target feature, and 80% (8 / 10) of the input feature's attribute values will be aggregated to the second target feature.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将用于将字段从输入多边形分摊到目标多边形的方法。</para>
        ///   <bulletList>
        ///     <bullet_item>面积—每个输入面对每个目标要素的汇总值的贡献量将由两个要素之间的重叠面积确定。如果输入要素与两个目标要素重叠的量相同，则分配的字段将一分为二，并按总值的一半对两个目标要素的贡献。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>长度 - 输入要素中的属性将根据每个目标要素中线的百分比进行划分。计算中仅包括与输入要素相交的线。输入要素外部的线被排除在外。例如，如果一个目标要素覆盖一条线的 750 米，而另一个目标要素覆盖一条线的 250 米，则输入要素的 75% （750 / 1000） 属性值将聚合到第一个目标要素，25% （250 / 1000） 的输入要素属性值将聚合到第二个目标要素。</bullet_item><para/>
        ///     <bullet_item>点—输入要素中的属性将根据与输入要素重叠的每个目标要素内的点数进行划分。输入要素之外的点被排除在外。或者，可以指定权重字段，以便使用每个目标要素中所有点的总权重来确定如何划分输入要素的属性值。例如，如果两个目标要素与一个输入要素重叠，并且第一个目标要素内有 2 个点，第二个目标要素内有 8 个点，则输入要素的 20% （2 / 10） 属性值将聚合到第一个目标要素中，80% （8 / 10） 的输入要素属性值将聚合到第二个目标要素中。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Apportion Method")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _method_value _method { get; set; }

        public enum _method_value
        {
            /// <summary>
            /// <para>Area</para>
            /// <para>Area—The amount that each input polygon contributes to the summarized values for each target feature will be determined by the area of overlap between the two features. If an input feature overlaps two target features by the same amount, the apportioned fields will be divided in two and contribute to both target features by half of the total value. This is the default.</para>
            /// <para>面积—每个输入面对每个目标要素的汇总值的贡献量将由两个要素之间的重叠面积确定。如果输入要素与两个目标要素重叠的量相同，则分配的字段将一分为二，并按总值的一半对两个目标要素的贡献。这是默认设置。</para>
            /// </summary>
            [Description("Area")]
            [GPEnumValue("AREA")]
            _AREA,

            /// <summary>
            /// <para>Length</para>
            /// <para>Length—The attributes from the input features will be divided based on the percentage of how much of a line is within each target feature. Only the line intersecting the input feature is included in the calculation. The line outside the input feature is excluded. For example, if one target feature covers 750 meters of a line, and another target feature covers 250 meters of a line, 75% (750 / 1000) of the input feature's attribute values will be aggregated to the first target feature, and 25% (250 / 1000) of the input feature's attribute values will be aggregated to the second target feature.</para>
            /// <para>长度 - 输入要素中的属性将根据每个目标要素中线的百分比进行划分。计算中仅包括与输入要素相交的线。输入要素外部的线被排除在外。例如，如果一个目标要素覆盖一条线的 750 米，而另一个目标要素覆盖一条线的 250 米，则输入要素的 75% （750 / 1000） 属性值将聚合到第一个目标要素，25% （250 / 1000） 的输入要素属性值将聚合到第二个目标要素。</para>
            /// </summary>
            [Description("Length")]
            [GPEnumValue("LENGTH")]
            _LENGTH,

            /// <summary>
            /// <para>Points</para>
            /// <para>Points—The attributes from the input features will be divided based on the number of points inside each target feature overlapping an input feature. Points outside of the input feature are excluded. Optionally, a weight field can be specified so that the total weight of all points within each target feature will be used to determine how the input features' attribute values are divided. For example, if two target features overlap one input feature, and there are two points inside the first target feature and eight points inside the second target feature, 20% (2 / 10) of the input feature's attribute values will be aggregated to the first target feature, and 80% (8 / 10) of the input feature's attribute values will be aggregated to the second target feature.</para>
            /// <para>点—输入要素中的属性将根据与输入要素重叠的每个目标要素内的点数进行划分。输入要素之外的点被排除在外。或者，可以指定权重字段，以便使用每个目标要素中所有点的总权重来确定如何划分输入要素的属性值。例如，如果两个目标要素与一个输入要素重叠，并且第一个目标要素内有 2 个点，第二个目标要素内有 8 个点，则输入要素的 20% （2 / 10） 属性值将聚合到第一个目标要素中，80% （8 / 10） 的输入要素属性值将聚合到第二个目标要素中。</para>
            /// </summary>
            [Description("Points")]
            [GPEnumValue("POINTS")]
            _POINTS,

        }

        /// <summary>
        /// <para>Estimation Features</para>
        /// <para>The input point or polyline features that will be used to estimate the percent of the input polygon apportion fields to apportion to the target polygon. This is the amount of the point or line within the intersection divided by the amount within the input feature to create a percentage.</para>
        /// <para>将用于估计要分摊到目标面的输入面分摊字段的百分比的输入点或折线要素。这是交点内的点或线的量除以输入要素内的量以创建百分比。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Estimation Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _estimation_features { get; set; } = null;


        /// <summary>
        /// <para>Weight Field</para>
        /// <para>A numeric field from the target polygons layer that will be used to adjust which target polygons receive larger apportioned values from the input polygons' fields to apportion. Targets with higher weight are apportioned a higher ratio of the field values.</para>
        /// <para>目标面图层中的数值字段，用于调整哪些目标面从输入面的字段接收更大的分摊值进行分摊。权重较高的目标分配的字段值比率较高。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Weight Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _weight_field { get; set; } = null;


        /// <summary>
        /// <para>Maintain target geometry</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the output feature class will maintain the original geometries from the target polygon layer.
        ///   <bulletList>
        ///     <bullet_item>Checked—The output feature class will maintain the original geometries of the target polygon layer. This is the default.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—The output feature class will be a geometric intersection of the target polygons and the input polygons. Only areas of the target polygons that overlap an input polygon will be included in the output.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定输出要素类是否将保留目标面图层中的原始几何。
        ///   <bulletList>
        ///     <bullet_item>选中 - 输出要素类将保留目标面图层的原始几何。这是默认设置。 </bullet_item><para/>
        ///     <bullet_item>未选中 - 输出要素类将为目标面和输入面的几何交点。输出中仅包括与输入面重叠的目标面区域。 </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maintain target geometry")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _maintain_geometries_value _maintain_geometries { get; set; } = _maintain_geometries_value._true;

        public enum _maintain_geometries_value
        {
            /// <summary>
            /// <para>MAINTAIN_GEOMETRIES</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("MAINTAIN_GEOMETRIES")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>INTERSECT_GEOMETRIES</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("INTERSECT_GEOMETRIES")]
            [GPEnumValue("false")]
            _false,

        }

        public ApportionPolygon SetEnv(object extent = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(extent: extent, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}